<?php
class Default_Model_Book extends Zend_Db_Table{
    protected $_name="bk_book";
    protected $_id="bk_id";
    public function listAll($control=true,$index=null)
    {
        if($control)
        {
              $select=$this->select();
             $select->from("bk_book", "*")
              ->join("bk_author","bk_author.au_id = bk_book.bk_author")
              ->setIntegrityCheck(false);
                return $this->fetchAll($select)->toArray();
        }
        
        else
        {
        //    echo $index; die();
            $select=$this->select();
            $select->from('bk_book','*')
             ->join("bk_author","bk_author.au_id = bk_book.bk_author")
              ->setIntegrityCheck(false)
            ->where("bk_id = ?",$index);
           $temp=  $this->fetchRow($select)->toArray();
           return $temp;
        }
    }
    public function listAuthor($control=true,$index=null)
    {
        if($control)
        {
            $select=$this->select();
            $select->from("bk_author","*");
            $temp=$this->fetchAll($select)->toArray();
            print_r($temp); die();
            
        }
    }
    
}